package com.cheney.diandireader.server.service;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.cheney.diandireader.server.dao.BaseDAO;
import com.cheney.diandireader.server.domain.AttachFileCategory;

@Service
public class FileCategoryService implements IService{
	
	private BaseDAO<AttachFileCategory> baseDAO;
	
	@Autowired
	public void setSessionFactory(@Qualifier("sessionFactory")SessionFactory sessionFactory){
		baseDAO = new BaseDAO<AttachFileCategory>(sessionFactory,AttachFileCategory.class);
	}
	
	//save
	public void save(AttachFileCategory attachFileType){
		baseDAO.save(attachFileType);
	}
	
	//findAll
	public List<AttachFileCategory> list(){
		return baseDAO.findAll();
	}
	
	//delete
	public void delete(AttachFileCategory attachFileType){
		if(attachFileType!=null)
		baseDAO.delete(attachFileType);
	}
	
	//update
	public void update(AttachFileCategory attachFileType){
		if(attachFileType!=null)
		baseDAO.update(attachFileType);
	}
}
